import request from '@/utils/request'

/*
* 验收工序
* */
// 查询验收工序列表
export function listCheckTable(query) {
  return request({
    url: '/gcxt/checktable/list',
    method: 'get',
    params: query
  })
}

// 新增验收工序
export function addCheckTable(data) {
  return request({
    url: '/gcxt/checktable/add',
    method: 'post',
    data: data
  })
}

// 修改验收工序
export function updateCheckTable(data) {
  return request({
    url: '/gcxt/checktable/edit',
    method: 'post',
    data: data
  })
}

// 删除验收工序
export function delCheckTable(checkId) {
  return request({
    url: '/gcxt/checktable/delete',
    method: 'post',
    data: { fid: checkId }
  })
}

/*
* 验收工序要点
* */
// 查询验收工序要点列表
export function listCheckTableEntry(query) {
  return request({
    url: '/gcxt/checktable/entrylist',
    method: 'get',
    params: query
  })
}

// 新增验收工序要点
export function addCheckTableEntry(data) {
  return request({
    url: '/gcxt/checktable/addEntry',
    method: 'post',
    data: data
  })
}

// 修改验收工序要点
export function updateCheckTableEntry(data) {
  return request({
    url: '/gcxt/checktable/editEntry',
    method: 'post',
    data: data
  })
}

// 删除验收工序要点
export function delCheckTableEntry(checkId) {
  return request({
    url: '/gcxt/checktable/deleteEntry/' + checkId,
    method: 'post'
  })
}

// 删除附件
export function delFile(checkId) {
  return request({
    url: '/gcxt/checktable/deleteFile/' + checkId,
    method: 'post',
    timeout: 60000
  })
}

// 附件列表
export function listFile(checkId) {
  return request({
    url: '/gcxt/checktable/fileList',
    method: 'get',
    params: { fid: checkId }
  })
}

// 获取自定义表单
export function listCustomForm(checkId) {
  return request({
    url: '/gcxt/checktable/getCustomForm',
    method: 'get',
    params: { fid: checkId }
  })
}

// 保存自定义方案
export function saveCustomForm(data) {
  return request({
    url: '/gcxt/checktable/saveCustomForm',
    method: 'post',
    data: data
  })
}

// 删除自定义方案
export function delCustomForm(checkId) {
  return request({
    url: '/gcxt/checktable/delCustomForm?checktableId=' + checkId,
    method: 'post'
  })
}

// 获取自定义表单
export function getPrecondition(checkTableId) {
  return request({
    url: '/gcxt/checktable/getPreconditionByCheckTableId',
    method: 'get',
    params: { checkTableId: checkTableId }
  })
}

// 删除自定义方案
export function saveOrUpdatePrecondition(data) {
  return request({
    url: '/gcxt/checktable/saveOrUpdatePrecondition',
    method: 'post',
    data: data
  })
}

// 查询验收工序列表
export function treeCheckTable(query) {
  return request({
    url: '/gcxt/checktable/tree',
    method: 'get',
    params: query
  })
}
